
module DrunkenMaster
  
  # Handles widgets' own files under their "public" directories.
  class Widget::WidgetFileHandler < Widget
    def initialize root_widget_class
      @module = Magic.module_of(root_widget_class)
    end
    
    def execute context
      root_class = context.tail[0]
      #@module...
      root = Loader::Load.dir_of(root_class+'.rb', @module) + '/public'
      context.tail = context.tail[1,:last]
      respond FileHandler.new(root).execute(context)
    end
  end
end